<template>
    <div class="process-content">
        <div class="process-card">
            <div class="card-info">
                <div class="info-title">
                    <div class="position-name">
                        <el-tooltip class="item" effect="dark" :content="data.usageDesc || data.usageScene"
                            placement="top">
                            <span class="name">{{ data.usageDesc || data.usageScene }}</span>

                        </el-tooltip>
                        <div>
                            <el-text style="color: #909399;line-height: 45px;">表单编号：{{ data.uuid }}</el-text>
                        </div>
                    </div>
                    <div class="position-keyword">
                        <el-button size="small" type="primary" plain @click="editDemand()">编辑</el-button>

                    </div>
                </div>
            </div>
            <div class="card-detail">
                <div class="detail-name">进度详情</div>
                <el-steps :active="data.state" finish-status="success" process-status="process"
                    style="width: 90%;margin: 30px auto 0px auto;">
                    <el-step title="已提交">
                        <template #description v-if="data.state === 0">
                            请耐心等待
                        </template>
                    </el-step>
                    <el-step title="已受理">
                        <template #description v-if="data.state === 1">
                            请耐心等待
                        </template>
                    </el-step>
                    <el-step title="进行中">
                        <template #description v-if="data.state === 2">
                            请耐心等待
                        </template>
                    </el-step>
                    <el-step title="已完成">
                        <template #description v-if="data.state === 3">
                            请耐心等待
                        </template>
                    </el-step>
                </el-steps>
            </div>
            <div class="card-message">
                <div class="detail-name">事件消息</div>
                <el-timeline style="max-width: 600px">
                    <el-timeline-item v-for="(activity, index) in data.activeMessage" :key="index"
                        :timestamp="activity.timestamp">
                        {{ activity.content }}
                    </el-timeline-item>
                </el-timeline>
            </div>
        </div>
    </div>
</template>

<script setup>
import { defineProps } from 'vue'
import { useRouter } from 'vue-router'
const router = useRouter()
const props = defineProps({
    data: Object,
})

const editDemand = () => {
    router.push({ name: 'form', query: { uuid: props.data.uuid } });
}


</script>

<style scoped>
.process-content {
    padding: 30px;
    background-color: #f5f5f5;
    border-radius: 8px;
}

.process-card {
    background-color: #ffffff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
    padding: 30px;
}

.card-info {
    margin-bottom: 30px;
}

.info-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 8px;
}

.position-name {
    max-width: 400px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 20px;
    line-height: 24px;
    letter-spacing: -.03em;
}

.position-keyword {
    color: rgba(0, 0, 0, .65);
    word-break: break-all;
    font-size: 14px;
    line-height: 24px;
    letter-spacing: -.02em;
}

.card-detail {
    margin-top: 20px;
    margin-bottom: 35px;
}



.detail-name {
    font-size: 18px;
    line-height: 24px;
    letter-spacing: -.03em;
    font-weight: 600;
    color: rgba(0, 0, 0, .85);
    margin-bottom: 24px;
}

/* Steps customization with :deep() */
:deep(.el-steps) {
    overflow: hidden;
    margin-top: 20px;
}

:deep(.el-step__icon) {
    width: 30px;
    height: 30px;
    color: #fff;
    background-color: rgba(0, 0, 0, .25);
}

:deep(.el-step__line) {
    display: block;
    background: #f0f0f0;
}

:deep(.el-step__icon.is-text) {
    border: none;
}

:deep(.el-step__head.is-process .el-step__icon) {
    background-color: #409EFF;
}

:deep(.el-step__head.is-success .el-step__icon) {
    background-color: #67C23A;
}

:deep(.el-step.is-horizontal .el-step__line) {
    top: 15px;
    left: 45px;
    width: 73%;
    height: 1px;
}

:deep(.el-step__head.is-success .el-step__line) {
    background-color: #b3e19d;
}

:deep(.el-step__description) {
    word-break: break-all;
    color: rgba(0, 0, 0, .45);
    max-width: 203px;
}

:deep(.el-step__icon-inner.is-status) {
    transform: translateY(-1px);
}
</style>